package main

import (
	"github.com/gin-gonic/gin"
	"shoping.zozoo.net/route"
	"shoping.zozoo.net/tool"
)

func main() {
	var (
		cfg *tool.Config
		err error
		app *gin.Engine
	)

	//获取配置文件
	cfg, err = tool.ParseConfig("./config/app.json")
	if err != nil {
		panic(err)
		return
	}

	//注册数据库orm
	_,err = tool.OrmEngine(cfg)
	if err != nil {
		panic(err)
	}

	app = gin.Default()

	//注册路由
	route.InitRouter(app)

	if err = app.Run(cfg.AppHost + ":" + cfg.AppPort); err != nil {
		panic(err)
	}
}
